package com.ruoyi.project.system.zbj.service.impl;

import java.util.Date;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.system.zbj.mapper.ZbjMapper;
import com.ruoyi.project.system.zbj.domain.Zbj;
import com.ruoyi.project.system.zbj.service.IZbjService;
import com.ruoyi.common.utils.text.Convert;

import static com.ruoyi.common.utils.security.ShiroUtils.getUserId;

/**
 * zbjService业务层处理
 * 
 * @author ruoyi
 * @date 2024-10-28
 */
@Service
public class ZbjServiceImpl implements IZbjService 
{
    @Autowired
    private ZbjMapper zbjMapper;

    /**
     * 查询zbj
     * 
     * @param zbjId zbj主键
     * @return zbj
     */
    @Override
    public Zbj selectZbjByZbjId(Long zbjId)
    {
        return zbjMapper.selectZbjByZbjId(zbjId);
    }

    /**
     * 查询zbj列表
     * 
     * @param
     * @return zbj
     */
    @Override
    public List<Zbj> selectZbjList(Long userId)
    {
        return zbjMapper.selectZbjList(userId);
    }

    /**
     * 新增zbj
     * 
     * @param zbj zbj
     * @return 结果
     */
    @Override
    public int insertZbj(Zbj zbj)
    {
        zbj.setUserId(getUserId());
        zbj.setCreatTime(DateUtils.getNowDate());
        return zbjMapper.insertZbj(zbj);
    }

    /**
     * 修改zbj
     * 
     * @param zbj zbj
     * @return 结果
     */
    @Override
    public int updateZbj(Zbj zbj)
    {
        zbj.setUpdateTime(DateUtils.getNowDate());
        return zbjMapper.updateZbj(zbj);
    }

    /**
     * 批量删除zbj
     * 
     * @param zbjIds 需要删除的zbj主键
     * @return 结果
     */
    @Override
    public int deleteZbjByZbjIds(String zbjIds)
    {
        return zbjMapper.deleteZbjByZbjIds(Convert.toStrArray(zbjIds));
    }

    /**
     * 删除zbj信息
     * 
     * @param zbjId zbj主键
     * @return 结果
     */
    @Override
    public int deleteZbjByZbjId(Long zbjId)
    {
        return zbjMapper.deleteZbjByZbjId(zbjId);
    }
}
